// same name method 
// add super() = same method in super class

var initializing = false;

function jClass(baseClass, prop) {
	if (typeof(baseClass) === "object") {
		prop = baseClass;
		baseClass = null;
	}

	function F() {
		if (!initializing) {
			this.init.apply(this, arguments);
		}
	}
	if (baseClass) {
		initializing = true;
		F.prototype = new baseClass();
		F.prototype.constructor = F;
		initializing = false;
	}

	for (var name in prop) {
		if (!prop.hasOwnProperty(name)) {
			continue;
		}

		if (baseClass && typeof(prop[name]) === "function" && typeof(F.prototype[name]) === "function") {
			// if same name function,then F.prototype[name] = a new function
			// in this new funciton, you can call this.base() = baseClass.prototype[name] 
			// but primary logic is prop[name]
			F.prototype[name] = (function(name, fn) {
				return function() {
					this.base = baseClass.prototype[name];
					return fn.apply(this, arguments);
				};
			})(name, prop[name]);
		} else {
			F.prototype[name] = prop[name];
		}
	}
	return F;
};
var Person = jClass({
	init: function(name) {
		this.name = name;
	},
	getName: function() {
		return this.name;
	}
});


var Employee = jClass(Person, {
	init: function(name, employeeID) {
		// this.name = name;
		this.employeeID = employeeID;
		this.base(name); // like java super.init(name);
	},
	getEmployeeID: function() {
		return this.employeeID;
	},
	getName: function() {
		return "Employee name: " + this.base(); // like java super.getName()
	}
});
var e = new Employee("zs", 012);
console.log(e.getName());
